const express = require('express');

const router = express.Router();

const getArt_handler = require('../router_handler/art');

const expressJoi = require('@escook/express-joi');

const {
  add_cate_schema,
  del_cate_schema,
  update_cate_schema,
} = require('../schema/art');

// * 获取文章列表
router.get('/cates', getArt_handler.getArt);
// * 添加文章分类
router.post('/addcates', expressJoi(add_cate_schema), getArt_handler.addArt);
// * 删除文章分类
router.get(
  '/deletecate/:id',
  expressJoi(del_cate_schema),
  getArt_handler.delArt
);
// * 根据id查找该列
router.get(
  '/cates/:id',
  expressJoi(del_cate_schema),
  getArt_handler.getArtCateById
);
// * 更新文章分类
router.post(
  '/updatecate',
  expressJoi(update_cate_schema),
  getArt_handler.updateCateById
);

module.exports = router;
